#include "widget.h"
#include <QApplication>
#include "mylabel.h"
#include "mypushbutton.h"
#include "myradiobutton.h"
#include "mylayout.h"
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;


    MyLabel *mylabel=new MyLabel(&w);
    MyPushButton *myBtn=new MyPushButton(&w);
    MyRadioButton *myRbtn=new MyRadioButton(&w);
    MyLayout *mylayout=new MyLayout(&w);

    MyLayout*sunlayout=new MyLayout(mylabel);
    MyPushButton*sunBtn1=new MyPushButton;
    MyPushButton*sunBtn2=new MyPushButton;
    MyPushButton*sunBtn3=new MyPushButton;

    sunBtn1->setText("孙按钮1");
    sunBtn2->setText("孙按钮2");
    sunBtn3->setText("孙按钮3");

    sunlayout->addWidget(sunBtn1);
    sunlayout->addWidget(sunBtn2);
    sunlayout->addWidget(sunBtn3);

    mylabel->setLayout(sunlayout);


    mylabel->setText("子标签");
    myBtn->setText("子按钮");
    myRbtn->setText("子单选");

    mylayout->addWidget(mylabel,0,0);
    mylayout->addWidget(myBtn,1,0);
    mylayout->addWidget(myBtn,2,0);

    w.setLayout(mylayout);
    w.show();

    const QObjectList list=w.children();
    qDebug()<<"w.children()";
    foreach (QObject* obj, list) {
        qDebug()<<obj;

    }

    return a.exec();
}
